package com.google.code.sysarch.v0.e32;

import com.google.code.sysarch.common.util.Parameter;

class v0_32 {

	public static void main(String[] args) {	
		/* Variable initialization */
		if (args.length == 0) {
			System.out.println("Usage: java v0_32 [-n NumberOfThreads] [-m InnerLoopCount] [-n0..4 OuterLoopCountForThread0..4]");
			System.exit(1);
		}		
		Parameter p = new Parameter(args);
		p.warnings = true;		
		iThread_32[] threads = new iThread_32[5];
		int numThreads = p.getInt("n",1,1,5);
		int innerCycles = p.getInt("m",100,1,500);
		int[] outerCycles = new int[numThreads];
		for (int i = 0; i < numThreads; i++) {
			outerCycles[i] = p.getInt("n"+i, 100, 1, 1000);
		}
		
		/*
		* Create numThreads SpeakingIThreads and start them
		*/
		for (int i = 0; i < numThreads; i++) {
			threads[i] = new iThread_32(outerCycles[i], innerCycles);
		}
		for (int i = 0; i < numThreads; i++) {
			threads[i].start();		
		}				
	}
	
}